package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 双向排序 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=100010;
       static int a[]=new int[N],auxi[]=new int[N],n,m;
       
       static void merge_sort(int l,int r,int[]a){
    	      if(l>=r)return;
    	      int mid=l+r>>1;
    	      merge_sort(l,mid,a);
    	      merge_sort(mid+1,r, a);
    	      int i=l,j=mid+1,k=0;
    	      while(i<=mid&&j<=r){
    	    	  if(a[i]<=a[j])auxi[k++]=a[i++];
    	    	  else auxi[k++]=a[j++];
    	      }
    	      while(i<=mid)auxi[k++]=a[i++];
    	      while(j<=r)auxi[k++]=a[j++];
    	      for(i=l,j=0;i<=r;i++,j++)
    	    	  a[i]=auxi[j];
       }
       static void merge_sort_d(int l,int r,int[]a){
 	      if(l>=r)return;
 	      int mid=l+r>>1;
 	      merge_sort_d(l,mid, a);
 	      merge_sort_d(mid+1, r, a);
 	      int i=l,j=mid+1,k=0;
 	      while(i<=mid&&j<=r){
 	    	  if(a[i]>=a[j])auxi[k++]=a[i++];
 	    	  else auxi[k++]=a[j++];
 	      }
 	      while(i<=mid)auxi[k++]=a[i++];
 	      while(j<=r)auxi[k++]=a[j++];
 	      for(i=l,j=0;i<=r;i++,j++)
 	    	  a[i]=auxi[j];
    }
       public static void main(String[] ss) throws IOException {
		      ss=br.readLine().split(" ");
		      n=Integer.parseInt(ss[0]);m=Integer.parseInt(ss[1]);
		      for(int i=1;i<=n;i++)
		    	  a[i]=i;
		      merge_sort_d(1, n, a);
		      while(m-->0){
		    	   ss=br.readLine().split(" ");
		    	   int p=Integer.parseInt(ss[0]),q=Integer.parseInt(ss[1]);
		    	   if(p==0){
		    		   merge_sort_d(1, q, a);
		    	   }else{
		    		   merge_sort(q, n, a);
		    	   }
		      }
		      for(int i=1;i<=n;i++)
		    	  System.out.print(a[i]+" ");
	}
}
